<?php

/**
 * Indicateur form base class.
 *
 * @method Indicateur getObject() Returns the current form's model object
 *
 * @package    KC-INDICATEURS
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseIndicateurForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'type_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Type'), 'add_empty' => false)),
      'libelle'       => new sfWidgetFormTextarea(),
      'libelle_court' => new sfWidgetFormInputText(),
      'commentaire'   => new sfWidgetFormTextarea(),
      'seuil_alerte'  => new sfWidgetFormInputText(),
      'seuil_erreur'  => new sfWidgetFormInputText(),
      'visuel'        => new sfWidgetFormInputCheckbox(),
      'historique'    => new sfWidgetFormInputCheckbox(),
      'from_mantis'   => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'type_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Type'))),
      'libelle'       => new sfValidatorString(array('max_length' => 1024)),
      'libelle_court' => new sfValidatorString(array('max_length' => 64, 'required' => false)),
      'commentaire'   => new sfValidatorString(array('max_length' => 1024, 'required' => false)),
      'seuil_alerte'  => new sfValidatorInteger(array('required' => false)),
      'seuil_erreur'  => new sfValidatorInteger(array('required' => false)),
      'visuel'        => new sfValidatorBoolean(array('required' => false)),
      'historique'    => new sfValidatorBoolean(array('required' => false)),
      'from_mantis'   => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('indicateur[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Indicateur';
  }

}
